<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.0.js"></script>
<script type="text/javascript">
	$(function(){
		$("#memberListTbody tr").children().find($(":input[id^=deleteMember]")).click(function(){
			 if(confirm($(this).parent().parent().children(":first").text()+"님을 탈퇴시키시겠습니까?")){
				location.href="memberdelete.do?id="+$(this).parent().parent().children(":first").text();
			}
		});//click
		$("input[id^=updateMember]").click(function(){
			var id=$(this).parent().parent().children(":first").text();
			var fp=$(this).parent().parent().children().find($("input[id^=fixedPoint]")).val();
			var gr=$(this).parent().parent().children().find($("select[id^=grade]")).val();
			if(confirm($(this).parent().parent().children(":first").text()+"님을 수정하시겠습니까?")){
				location.href="admin_updateMember.do?id="+id+"&fixedPoint="+fp+"&grade="+gr;
			}
		});//click
	});//ready
</script>
<style type="text/css">
.adminBtn {
	font-size:12px;
	font-family:Verdana;
	font-weight:bold;
	-moz-border-radius:2px;
	-webkit-border-radius:2px;
	border-radius:2px;
	border:1px solid #dcdcdc;
	padding:5px 10px;
	text-decoration:none;
	background:-webkit-gradient( linear, left top, left bottom, color-stop(5%, #d9d5d9), color-stop(100%, #bababa) );
	background:-moz-linear-gradient( center top, #d9d5d9 5%, #bababa 100% );
	background:-ms-linear-gradient( top, #d9d5d9 5%, #bababa 100% );
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#d9d5d9', endColorstr='#bababa');
	background-color:#d9d5d9;
	color:#4f4f4f;
	display:inline-block;
	text-shadow:0px 0px 0px #ffffff;
 	-webkit-box-shadow:inset 0px 0px 0px 0px #ffffff;
 	-moz-box-shadow:inset 0px 0px 0px 0px #ffffff;
 	box-shadow:inset 0px 0px 0px 0px #ffffff;
}.adminBtn:hover {
	background:-webkit-gradient( linear, left top, left bottom, color-stop(5%, #bababa), color-stop(100%, #d9d5d9) );
	background:-moz-linear-gradient( center top, #bababa 5%, #d9d5d9 100% );
	background:-ms-linear-gradient( top, #bababa 5%, #d9d5d9 100% );
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#bababa', endColorstr='#d9d5d9');
	background-color:#bababa;
}.adminBtn:active {
	position:relative;
	top:1px;
}

#board {
	margin:0px;padding:0px;
	width:80%;
	margin: 0 auto;
}
#board table{
    border-collapse: collapse;
    border-spacing: 0;
	width:100%;
	height:100%;
	margin:0px;
	padding:0px;
}
#board td{
	vertical-align:middle;
	
	background-color:#ffffff;

	border:1px solid #000000;
	border-width:0px 1px 1px 0px;
	text-align:left;
	padding:7px;
	font-size:15px;
	font-family:NanumGothic;
	font-weight:normal;
	color:#000000;
}
#board tr:first-child th{
	background:-o-linear-gradient(bottom, #cccccc 5%, #b2b2b2 100%);	
	background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #cccccc), color-stop(1, #b2b2b2) );
	background:-moz-linear-gradient( center top, #cccccc 5%, #b2b2b2 100% );
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#cccccc", endColorstr="#b2b2b2");	background: -o-linear-gradient(top,#cccccc,b2b2b2);

	background-color:#cccccc;
	border:0px solid #000000;
	text-align:center;
	border-width:0px 0px 1px 1px;
	font-size:14px;
	font-family:Arial;
	font-weight:bold;
	color:#000000;
	height: 30px;
}
a.adminlink:link 
{
	color:#000000;
	text-decoration: none;
}
a.adminlink:VISITED 
{
	color:#000000;
	text-decoration: none;	
}
a.adminlink:ACTIVE 
{
	color:#000000;
	text-decoration: none;
}
a.adminlink:hover
{
	color:#000000;
	text-decoration: none;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
	$("#admin td").hover(function(){
			$(this).css("background","gray");
		},function(){
			$(this).css("background","white");
		});
});//ready
</script>
</head>
<body>
<h2 align="center">관리자 페이지</h2>
<br>
<table align="center" id="admin">
	<tr>
		<td><a href = "${initParam.root }/admin_member.do" class="adminlink">회원관리</a></td>
		<td><a href = "${initParam.root}/admin_point.do" class="adminlink">포인트 증감</a></td>
		<td><a href = "${initParam.root}/admin_post.do" class="adminlink">게시물 이동</a></td>
	</tr>
</table>
<br>
<table border="1" align="center" id="board">
<thead>
	<tr>
		<th>아이디</th><th>닉네임</th><th>이름</th><th>주소</th><th>현포인트</th><th>누적포인트</th><th>등급</th><th>정보수정</th><th>강제탈퇴</th>
	</tr>
</thead>
<tbody id="memberListTbody">
	<c:forEach items="${requestScope.memberList }" var="memberInfo">
	<tr>
		<td>${memberInfo.id }</td>
		<td>${memberInfo.nick }</td>
		<td>${memberInfo.name }</td>
		<td>${memberInfo.address }</td>
		<td>${memberInfo.floatingPoint }</td>
		<td> <input type="hidden" id="fixedPoint" value="${memberInfo.fixedPoint }"> ${memberInfo.fixedPoint }</td>
		<c:choose>
		<c:when test="${memberInfo.grade == 'Manager'}">
		<td> ${memberInfo.grade }</td>
			<td></td>
			<td></td>
		</c:when>
		<c:otherwise>
		<td><select id="grade" >
			<option value="${memberInfo.grade }">${memberInfo.grade } </option>
			<c:forEach items="${requestScope.gradeList }" var="gradeInfo">
			<c:if test="${memberInfo.grade!=gradeInfo }">
			<option value="${gradeInfo }">${gradeInfo } </option></c:if>
			</c:forEach>
		</select> 
		</td>
			<td><input type="button" id="updateMember" value="수정" class="adminBtn"></td>
			<td><input type="button" id="deleteMember" value="탈퇴" class="adminBtn"></td>
		</c:otherwise>
		</c:choose>
	</tr>
	</c:forEach>
</tbody>
</table>
</body>
</html>